from typing import Optional
from datetime import datetime
from pydantic import BaseModel, Field

class SessionBase(BaseModel):
    """会话基础信息"""
    user_id: int = Field(..., description="用户ID")
    expires_at: datetime = Field(..., description="过期时间")

class SessionCreate(SessionBase):
    """创建会话的请求模型"""
    pass

class SessionInDB(SessionBase):
    """数据库中的会话模型"""
    id: str
    created_at: datetime
    updated_at: datetime

    class Config:
        orm_mode = True

class SessionResponse(SessionInDB):
    """API响应中的会话模型"""
    pass